var util = require('../../utils/util.js');
var page = 1;
var uid = 0;
var noMore = false;
var app = getApp();
Page({
  data: {
      result:[],
      imgDomain: app.globalData.imgDomain
  },
  loadMore:function(){
      if(!noMore){
        page ++;
        this.load();
      }
  },
  onLoad: function(data){
    uid = data.uid || "";
    this.load();
  },
  load:function(){
    var that = this;
    util.api({
        data:{
            publickey:util.publiccode,
            ac:"topiclist",
            postuid:uid,
            topictype:9,
            toporder:1,
            page:page,
            num:20
        },
        success:function(responseData){
            var result = responseData.data;
            if(result && result.length > 0){
                result.forEach(function(m,i){
                if(m.photos)
                    result[i].photosData = m.photos.split(",");
                });
                that.setData({
                    result:that.data.result.concat(result)
                });
            }else{
                noMore = true;
            }
        }
    });
  }
})